package com.dog.basics.admin.controller.mtkj;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.mtkj.ShopGoodTypeFromDto;
import com.dog.basics.bean.vo.admin.mtkj.ShopGoodTypeFromVo;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.mtkj.IMtShopGoodTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 店铺商品类型表 前端控制器
 * </p>
 *
 * @author wph
 * @since 2020-11-09
 */
@Api(value = "店铺商品类型模块", tags = "店铺商品类型模块")
@RestController
@RequestMapping("/admin/shopgoodtype")
@AllArgsConstructor
public class MtShopGoodTypeController {

    private final IMtShopGoodTypeService shopGoodTypeService;


    /**
     * 删除店铺商品类型
     * @param id
     * @return
     * @author hangdy
     */
    @SysLog("删除店铺商品类型")
    @ApiOperation(value = "删除店铺商品类型", notes = "admin:goodtype:shopgoodtypedelete")
    @ApiImplicitParam(value = "店铺商品类型Id", name = "id", dataType = "Long", required = true)
    @DeleteMapping("/delete/{id}")
    @PreAuthorize("@pms.hasPermission('admin:goodtype:shopgoodtypedelete')")
    public R<Boolean> delete(@PathVariable("id") Long id) {
        return R.ok(shopGoodTypeService.adminDeleteShopGoodType(id));
    }
    /**
     * 查询商铺商品类型
     * @param: page
     * @param: dto
     * @returns
     * @author hangdy
     * @date: 2020/11/14 17:17
     */
    @ApiOperation(value = "查询店铺商品类型", notes = "admin:goodtype:findGoodTypes")
    @GetMapping("/findGoodTypes")
    @PreAuthorize("@pms.hasPermission('admin:goodtype:findGoodTypes')")
    public R<IPage<ShopGoodTypeFromVo>> findGoodTypeList(PageParam page ,ShopGoodTypeFromDto dto){
        return R.ok(shopGoodTypeService.adminFindShopGoodTypeList(page,dto));
    }

}
